package com.treeroot.rocketproduct.producer;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class MyProducer {
    @Resource
    private RocketMQTemplate rocketMQTemplate;

    /**
     *
     * @param topic 发到哪里
     * @param message 发的内容
     */
    public  void sendMessage(String topic,String message){
        rocketMQTemplate.convertAndSend(topic,message);

    }
}
